<?php
error_reporting(E_ALL);

//lettura file cartella
if ($handle = opendir('../../content')) {
    
	$toJson = '';
	while (false !== ($entry = readdir($handle))) {
		
		if ($entry == "." || $entry == "..")
		{
			continue;
		}
			
		$obj->date = '';
		$obj->project = '';
		$obj->path = '';
		
		$filename = explode("_",$entry);
		
		if (count($filename) > 2) {
			$obj->date 		= $filename[2]."/".$filename[1]."/".$filename[0];
			$obj->project 	= $filename[3];
			$obj->path		= $entry;
		}
		
		$toJson[] = $obj;
		unset($obj);
		
    }
    
    closedir($handle);    
    
    echo json_encode($toJson);    
    
}
?>
